package com.tool.leadData;

import com.core.jdbc.SqlHelper;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Description:
 * @author: liujian
 * @date: 2020/5/25
 */
public class addHuanjie {
    public static void main(String[] args) throws SQLException {
        addHujie();

    }

    private static void addHujie() throws SQLException {
        List<String> sqlList=new ArrayList<>();
        String sql="SELECT c.* from kccoursegrade cg JOIN kccourse c on cg.id=c.cgid and cg.coursetype=1 and cg.grade=2 ORDER BY c.coursesortnum asc;";
        List<Map<String,Object>> list= SqlHelper.queryMapList(sql,new HashMap<>());
        for (Map<String,Object>map :list){
            String id=map.get("id").toString();
            String code=map.get("code").toString();
            String sqlIn="insert into kccourselist (cid,status,tlid,issecond,isscore,teachduration,isop,linksortnum) values ("+id+",1,28,0,0,3,1,1);";
            System.out.println(sqlIn);
            sqlList.add(sqlIn);
            String sqlIn2="insert into kccourselist (cid,status,tlid,issecond,isscore,teachduration,isop,linksortnum) values ("+id+",1,23,0,0,3,1,2);";
            System.out.println(sqlIn2);
            sqlList.add(sqlIn2);
        }
        SqlHelper.sqlOperateList(sqlList);
    }
}
